package com.netease.yunxin.app.qchat.network;


import java.io.IOException;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class Main {
    public static void main(String[] args) {
        ApiClient.ApiService apiService = ApiClient.getApiService();

        // Call verify API
        Call<ResponseBody> verifyCall = apiService.verify("15171181119");
        verifyCall.enqueue(new Callback<ResponseBody>() {
            @Override
            public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
                if (response.isSuccessful()) {
                    // Handle successful response
                    try {
                        String responseBody = response.body().string();
                        System.out.println("verify response: " + responseBody);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                } else {
                    // Handle unsuccessful response
                    System.out.println("verify request failed");
                }
            }

            @Override
            public void onFailure(Call<ResponseBody> call, Throwable t) {
                // Handle request failure
                System.out.println("verify request failed");
            }
        });

        // Call phoneLogin API
        Call<ResponseBody> phoneLoginCall = apiService.phoneLogin("15171181119", "1");
        phoneLoginCall.enqueue(new Callback<ResponseBody>() {
            @Override
            public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
                if (response.isSuccessful()) {
                    // Handle successful response
                    try {
                        String responseBody = response.body().string();
                        System.out.println("phoneLogin response: " + responseBody);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                } else {
                    // Handle unsuccessful response
                    System.out.println("phoneLogin request failed");
                }
            }

            @Override
            public void onFailure(Call<ResponseBody> call, Throwable t) {
                // Handle request failure
                System.out.println("phoneLogin request failed");
            }
        });
    }
}